package ex4;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class 代理处理器 implements InvocationHandler {

    private Object target;
    public void setTarget(Object target){
        this.target = target;
    }

    //真正去工作(处理)的地方
    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("--代理前期准备工作--");
        System.out.println("查找房源.");
        System.out.println("联系卖家.");
        System.out.println("接送服务.\n");

        method.invoke(target,args);

        System.out.println("\n--代理后期跟踪--");
        System.out.println("与卖家沟通价格");
        System.out.println("中介费 1.5%");
        return null;
    }
}
